/**
 * output package name
 */
package com.kingdee.eas.basedata.org.client;

import java.util.Calendar;
import java.util.Date;

import org.apache.log4j.Logger;

import com.kingdee.bos.ctrl.kdf.table.event.KDTMouseEvent;
import com.kingdee.bos.metadata.entity.FilterInfo;
import com.kingdee.bos.metadata.entity.FilterItemInfo;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.ui.face.CoreUIObject;
import com.kingdee.eas.framework.ICoreBase;

/**
 * output class name
 */
public class CurMonthOrgLogUI extends AbstractCurMonthOrgLogUI {
	private static final Logger logger = CoreUIObject
			.getLogger(CurMonthOrgLogUI.class);

	/**
	 * output class constructor
	 */
	public CurMonthOrgLogUI() throws Exception {
		super();
	}

	/**
	 * output storeFields method
	 */
	public void storeFields() {
		super.storeFields();
	}

	private Date getFirstDate() {
		Calendar cal = Calendar.getInstance();
		cal.set(Calendar.DATE, 1);
		cal.set(Calendar.HOUR_OF_DAY, 0);
		cal.set(Calendar.MINUTE, 0);
		cal.set(Calendar.SECOND, 0);
		cal.set(Calendar.MILLISECOND, 0);
		return cal.getTime();
	}

	private Date getLastDate() {
		Calendar cal = Calendar.getInstance();
		cal.add(Calendar.MONTH, 1);
		cal.set(Calendar.DATE, 1);
		cal.add(Calendar.DATE, -1);
		cal.set(Calendar.HOUR_OF_DAY, 23);
		cal.set(Calendar.MINUTE, 59);
		cal.set(Calendar.SECOND, 59);
		cal.set(Calendar.MILLISECOND, 999);
		return cal.getTime();
	}

	protected ICoreBase getBizInterface() throws Exception {
		return null;
	}

	protected String getEditUIName() {
		return null;
	}

	protected FilterInfo getDefaultFilterForQuery() {
		FilterInfo filter = new FilterInfo();
		filter.getFilterItems().add(
				new FilterItemInfo("alterTime", getFirstDate(),
						CompareType.GREATER_EQUALS));
		filter.getFilterItems().add(
				new FilterItemInfo("alterTime", getLastDate(),
						CompareType.LESS_EQUALS));
		return filter;
	}

	protected String getKeyFieldName() {
		return "id";
	}

	public void onLoad() throws Exception {
		super.onLoad();
		this.btnView.setVisible(false);
		this.btnAddNew.setVisible(false);
		this.btnEdit.setVisible(false);
		this.btnRemove.setVisible(false);
		this.btnQuery.setVisible(false);
		this.btnLocate.setVisible(false);
		this.btnPrint.setVisible(false);
		this.btnPrintPreview.setVisible(false);

		this.menuItemView.setVisible(false);
		this.menuItemAddNew.setVisible(false);
		this.menuItemEdit.setVisible(false);
		this.menuItemRemove.setVisible(false);
		this.menuItemQuery.setVisible(false);
		this.menuItemLocate.setVisible(false);
		this.menuItemPrint.setVisible(false);
		this.menuItemPrintPreview.setVisible(false);
		this.menuEdit.setVisible(false);

		this.tblMain.getStyleAttributes().setLocked(true);
		this.tblMain.getColumn("id").getStyleAttributes().setHided(true);
	}

	protected void tblMain_tableClicked(KDTMouseEvent e) throws Exception {
	}
}